<template>
  <div>
    <!-- 轮播图 -->
    <swperBox :swperList="swperList" :flag="true"></swperBox>

    <!-- 六宫格布局 -->
    <ul class="mui-table-view mui-grid-view mui-grid-9">
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <router-link to="/home/newlist">
          <img src="../../images/menu1.png" alt srcset>
          <div class="mui-media-body">新闻资讯</div>
        </router-link>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <router-link to="/home/photolist">
          <img src="../../images/menu2.png" alt srcset>
          <div class="mui-media-body">图片分享</div>
        </router-link>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <router-link to="/home/goodslist">
          <img src="../../images/menu3.png" alt srcset>
          <div class="mui-media-body">商品购买</div>
        </router-link>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <router-link to="/newlist">
          <img src="../../images/menu4.png" alt srcset>
          <div class="mui-media-body">留言反馈</div>
        </router-link>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <router-link to="/newlist">
          <img src="../../images/menu5.png" alt srcset>
          <div class="mui-media-body">视频专区</div>
        </router-link>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <router-link to="/newlist">
          <img src="../../images/menu6.png" alt srcset>
          <div class="mui-media-body">联系我们</div>
        </router-link>
      </li>
    </ul>
  </div>
</template>

<script>
// 导入 Toast 组件
import { Toast } from "mint-ui";
import swperBox from "../subcomponent/Swiper.vue";

export default {
  data() {
    return {
      swperList: null
    };
  },
  created() {
    this.getSwper();
  },
  methods: {
    getSwper() {
      this.$http.get("api/getlunbo").then(function(res) {
        let data = res.body;
        if (data.status === 0) {
          this.swperList = data.message;
        } else {
          Toast("轮播图获取失败");
        }
      });
    }
  },
  components: {
    swperBox
  }
};
</script>   

<style lang="scss" scoped>
.mui-grid-view.mui-grid-9 {
  background: #fff;
  border: none;
  .mui-table-view-cell {
    border: none;
    .mui-media-body {
      font-size: 13px;
    }
  }
  img {
    width: 50%;
  }
}
</style>
